require 'test/unit'
require_relative 'cool_factory'
require_relative 'uncool_factory'
require_relative 'deadly_factory'

class TcSingleton < Test::Unit::TestCase

  def test_singleton
    coolFactory1 = CoolFactory.instance
    coolFactory2 = CoolFactory.instance
    uncoolFactory1 = UncoolFactory.instance
    uncoolFactory2 = UncoolFactory.instance
    deadlyFactory1 = DeadlyFactory.instance
    deadlyFactory2 = DeadlyFactory.instance

    assert_equal(coolFactory1, coolFactory2, "Multiple instances found")
    assert_equal(uncoolFactory1, uncoolFactory2, "Multiple instances found")
    assert_equal(deadlyFactory1, deadlyFactory2, "Multiple instances found")
  end

end